home *** CD-ROM | disk | FTP | other *** search
/ Champak 106 / Vol 106.iso / games / global_r.swf / scripts / __Packages / AirExplosion.as next >
Encoding:
Text File  |  2010-04-12  |  1.5 KB  |  47 lines

  1. class AirExplosion
  2. {
  3.    var position;
  4.    var bmpCanvas;
  5.    var bmpExplosion;
  6.    var scale;
  7.    var screenPos;
  8.    function AirExplosion(pos)
  9.    {
  10.       this.position = pos.clone();
  11.       this.bmpCanvas = Game.bmpDead;
  12.       this.bmpExplosion = flash.display.BitmapData.loadBitmap("explosion3");
  13.       this.scale = 0;
  14.       Sounds.playSound("explsion");
  15.    }
  16.    function step(Void)
  17.    {
  18.       this.scale += (0.75 - this.scale) * 0.15;
  19.       if(this.scale > 0.7)
  20.       {
  21.          Game.getInstance().removeHostileShot(this);
  22.       }
  23.    }
  24.    function draw(leftEdge)
  25.    {
  26.       var _loc5_ = this.position.x - leftEdge;
  27.       var _loc7_ = this.position.y;
  28.       this.screenPos = new flash.geom.Point(_loc5_,_loc7_);
  29.       var _loc2_ = new flash.geom.Matrix();
  30.       _loc2_.translate((- this.bmpExplosion.width) / 2,(- this.bmpExplosion.height) / 2);
  31.       var _loc6_ = new flash.geom.Matrix();
  32.       _loc6_.scale(this.scale,this.scale);
  33.       _loc2_.concat(_loc6_);
  34.       var _loc13_ = this.bmpExplosion.width * this.scale / 2;
  35.       var _loc12_ = this.bmpExplosion.height * this.scale / 2;
  36.       var _loc4_ = new flash.geom.Matrix();
  37.       _loc4_.translate(_loc5_,Game.screenH - this.position.y);
  38.       _loc2_.concat(_loc4_);
  39.       var _loc3_ = (1 - this.scale / 0.7) * 255;
  40.       var _loc9_ = new flash.geom.ColorTransform(0,0,0,1 - this.scale,_loc3_,_loc3_,_loc3_,_loc3_);
  41.       var _loc8_ = "normal";
  42.       var _loc10_ = null;
  43.       var _loc11_ = true;
  44.       this.bmpCanvas.draw(this.bmpExplosion,_loc2_,_loc9_,_loc8_,_loc10_,_loc11_);
  45.    }
  46. }
  47.